Add RISC-V RVV optimization support for zstd C library compilation#355
Open
Dayuxiaoshui wants to merge 2 commits intogyscos:mainfrom
Open
Add RISC-V RVV optimization support for zstd C library compilation#355Dayuxiaoshui wants to merge 2 commits intogyscos:mainfrom
Dayuxiaoshui wants to merge 2 commits intogyscos:mainfrom
Conversation
This commit adds automatic RISC-V RVV (RISC-V Vector Extension) optimization support when building the zstd C library on RISC-V 64-bit platforms. Changes: - Detect riscv64 target architecture in build.rs - Automatically apply -march=rv64gcv flag (with fallback to -march=rv64gc) - Add -O3 optimization level for RISC-V builds - Use flag_if_supported_with_fallbacks to gracefully handle unsupported flags The optimization is automatically applied when compiling on riscv64 targets, with graceful fallback if the compiler doesn't support RVV extensions. Tested on: - RISC-V 64-bit platform (riscv64) - All tests pass (32 unit tests + 1 integration test + 4 doc tests) - Build successful with both debug and release profiles This enables better performance for zstd compression/decompression on RISC-V platforms that support vector extensions. Co-authored-by: gong-flying <gongxiaofei24@iscas.ac.cn>
Owner
|
Hi, and thanks for the PR! Everything looks fine - I'm just wondering if the |
Author
|
Thanks for the feedback! You're absolutely right. I've updated the patch to only apply |
Update RISC-V RVV optimization to only apply -O3 flag in release builds, respecting the optimization level requested by the user. This addresses the review feedback to make optimization level conditional rather than always applied. Co-authored-by: gong-flying <gongxiaofei24@iscas.ac.cn>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds automatic RISC-V RVV (RISC-V Vector Extension) optimization support when building the zstd C library on RISC-V 64-bit platforms.
Changes:
Detect riscv64 target architecture in build.rs
Automatically apply -march=rv64gcv flag (with fallback to -march=rv64gc)
Add -O3 optimization level for RISC-V builds
Use flag_if_supported_with_fallbacks to gracefully handle unsupported flags
The optimization is automatically applied when compiling on riscv64 targets, with graceful fallback if the compiler doesn't support RVV extensions.
Tested on:
RISC-V 64-bit platform (riscv64)
All tests pass (32 unit tests + 1 integration test + 4 doc tests)
Build successful with both debug and release profiles
This enables better performance for zstd compression/decompression on RISC-V platforms that support vector extensions.